<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>docker介绍 | 清峰小栈</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  
  <meta name="keywords" content="docker" />
  
  
  
  
  <meta name="description" content="更新中….  一、docker安装1、yum 包更新到最新  1yum update  2、安装需要的软件包， yum-util 提供yum-config-manager功能，另外两个是devicemapper驱动依赖的  1yum install -y yum-utils device-mapper-persistent-data lvm2  3、 设置yum源 1yum-config-man">
<meta property="og:type" content="article">
<meta property="og:title" content="Docker介绍">
<meta property="og:url" content="http://example.com/2022/01/27/Docker/Docker%E4%BB%8B%E7%BB%8D/index.html">
<meta property="og:site_name" content="清峰小栈">
<meta property="og:description" content="更新中….  一、docker安装1、yum 包更新到最新  1yum update  2、安装需要的软件包， yum-util 提供yum-config-manager功能，另外两个是devicemapper驱动依赖的  1yum install -y yum-utils device-mapper-persistent-data lvm2  3、 设置yum源 1yum-config-man">
<meta property="og:locale" content="en_US">
<meta property="og:image" content="https://gitee.com/lindaifeng/img/raw/master/img/20220123231219.png">
<meta property="article:published_time" content="2022-01-27T06:41:55.150Z">
<meta property="article:modified_time" content="2023-04-28T08:50:28.810Z">
<meta property="article:author" content="清峰">
<meta property="article:tag" content="docker">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://gitee.com/lindaifeng/img/raw/master/img/20220123231219.png">
  

  

  <link rel="icon" href="/qingfeng-blog/css/images/mylogo-2.png">
  <link rel="apple-touch-icon" href="/qingfeng-blog/css/images/mylogo-2.png">
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link href="https://fonts.googleapis.com/css?family=Open+Sans|Montserrat:700" rel="stylesheet" type="text/css">
  <link href="https://fonts.googleapis.com/css?family=Roboto:400,300,300italic,400italic" rel="stylesheet" type="text/css">
  <!-- <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> -->
  <link href="/qingfeng-blog/css/font-awesome.css" rel="stylesheet">
  <style type="text/css">
    @font-face{font-family:futura-pt; src:url("/qingfeng-blog/css/fonts/FuturaPTBold.otf") format("woff");font-weight:500;font-style:normal;}
    @font-face{font-family:futura-pt-light; src:url("/qingfeng-blog/css/fonts/FuturaPTBook.otf") format("woff");font-weight:lighter;font-style:normal;}
    @font-face{font-family:futura-pt-italic; src:url("/qingfeng-blog/css/fonts/FuturaPTBookOblique.otf") format("woff");font-weight:400;font-style:italic;}
}

  </style>
  
<link rel="stylesheet" href="/qingfeng-blog/css/style.css">


  
<script src="/qingfeng-blog/js/jquery-3.1.1.min.js"></script>

  
<script src="/qingfeng-blog/js/bootstrap.js"></script>


  <!-- Bootstrap core CSS -->
  <link rel="stylesheet" href="/qingfeng-blog/css/bootstrap.css" >

  
    
<link rel="stylesheet" href="/qingfeng-blog/css/dialog.css">

  

  

  
    <link rel="stylesheet" href="/qingfeng-blog/css/header-post.css" >
  

  
  
  
    <link rel="stylesheet" href="/qingfeng-blog/css/vdonate.css" >
  

<meta name="generator" content="Hexo 6.3.0"></head>



  <body data-spy="scroll" data-target="#toc" data-offset="50">


  
  <div id="container">
    <div id="wrap">
      
        <header>

    <div id="allheader" class="navbar navbar-default navbar-static-top" role="navigation">
        <div class="navbar-inner">
          
          <div class="container"> 
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
              <span class="sr-only">Toggle navigation</span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
            </button>

            
              <a class="brand" style="
                 border-width: 0px;  margin-top: 0px;"  
                href="#" data-toggle="modal" data-target="#myModal" >
                  <img width="155px" height="90px" alt="Hike News" src="/qingfeng-blog/css/images/mylogo-2.png">
              </a>
            
            
            <div class="navbar-collapse collapse">
              <ul class="hnav navbar-nav">
                
                  <li> <a class="main-nav-link" href="/qingfeng-blog/">首页</a> </li>
                
                  <li> <a class="main-nav-link" href="/qingfeng-blog/categories">分类</a> </li>
                
                  <li> <a class="main-nav-link" href="/qingfeng-blog/tags">标签</a> </li>
                
                  <li><div id="search-form-wrap">

    <form class="search-form">
        <input type="text" class="ins-search-input search-form-input" placeholder="" />
        <button type="submit" class="search-form-submit"></button>
    </form>
    <div class="ins-search">
    <div class="ins-search-mask"></div>
    <div class="ins-search-container">
        <div class="ins-input-wrapper">
            <input type="text" class="ins-search-input" placeholder="Type something..." />
            <span class="ins-close ins-selectable"><i class="fa fa-times-circle"></i></span>
        </div>
        <div class="ins-section-wrapper">
            <div class="ins-section-container"></div>
        </div>
    </div>
</div>
<script>
(function (window) {
    var INSIGHT_CONFIG = {
        TRANSLATION: {
            POSTS: 'Posts',
            PAGES: 'Pages',
            CATEGORIES: 'Categories',
            TAGS: 'Tags',
            UNTITLED: '(Untitled)',
        },
        ROOT_URL: '/qingfeng-blog/',
        CONTENT_URL: '/qingfeng-blog/content.json',
    };
    window.INSIGHT_CONFIG = INSIGHT_CONFIG;
})(window);
</script>

<script src="/qingfeng-blog/js/insight.js"></script>


</div></li>
            </div>
          </div>
                
      </div>
    </div>

</header>



      
            
      <div id="content" class="outer">
        
          <section id="main" style="float:none;"><article id="post-Docker/Docker介绍" style="width: 75%; float:left;" class="article article-type-post" itemscope itemprop="blogPost" >
<div id="container">
  <div id="articleInner" class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 class="thumb" class="article-title" itemprop="name">
      Docker介绍
    </h1>
  

      </header>
    
    <div class="article-meta">
      
	<a href="/qingfeng-blog/2022/01/27/Docker/Docker%E4%BB%8B%E7%BB%8D/" class="article-date">
	  <time datetime="2022-01-27T06:41:55.150Z" itemprop="datePublished">2022-01-27</time>
	</a>

      
    <a class="article-category-link" href="/qingfeng-blog/categories/Docker/">Docker</a>

      
	<a class="article-views">
	<span id="busuanzi_container_page_pv">
		PV:<span id="busuanzi_value_page_pv"></span>
	</span>
	</a>

      

    </div>
    <div class="article-entry" itemprop="articleBody">
      
        <blockquote>
<p>更新中….</p>
</blockquote>
<h1 id="一、docker安装"><a href="#一、docker安装" class="headerlink" title="一、docker安装"></a>一、docker安装</h1><p>1、yum 包更新到最新 </p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yum update</span><br></pre></td></tr></table></figure>

<p>2、安装需要的软件包， yum-util 提供yum-config-manager功能，另外两个是devicemapper驱动依赖的 </p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yum install -y yum-utils device-mapper-persistent-data lvm2</span><br></pre></td></tr></table></figure>

<p>3、 设置yum源</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo</span><br></pre></td></tr></table></figure>

<p>4、 安装docker，出现输入的界面都按 y </p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yum install -y docker-ce</span><br></pre></td></tr></table></figure>

<p>5、 查看docker版本，验证是否验证成功</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker -v</span><br></pre></td></tr></table></figure>

<p>虚拟机，镜像，容器</p>
<p>虚拟机：以操作系统为内核创建的一个虚拟的操作系统</p>
<p>镜像：类似于安装包。</p>
<p>容器：类似于进程，运行在虚拟机里的一个个app。</p>
<h1 id="二、docker常用命令"><a href="#二、docker常用命令" class="headerlink" title="二、docker常用命令"></a>二、docker常用命令</h1><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br></pre></td><td class="code"><pre><span class="line">查询所有容器</span><br><span class="line">docker ps -a</span><br><span class="line">查看运行中的容器</span><br><span class="line">docker ps</span><br><span class="line">停止容器</span><br><span class="line">docker stop 容器id</span><br><span class="line">删除容器</span><br><span class="line">docker rm -f id</span><br><span class="line">启动容器(前台运行)</span><br><span class="line">docker run -p 80:80 nginx</span><br><span class="line">后台运行</span><br><span class="line">docker run -d -p 80:80 nginx</span><br><span class="line">启动容器并进入交互式模式(默认加sh)</span><br><span class="line">docker run -it 镜像id sh</span><br><span class="line">进入容器内部</span><br><span class="line">docker exec -it 容器id sh</span><br><span class="line">删除镜像</span><br><span class="line">docker rmi 镜像id(id一致时用名称:标签删docker rmi ubuntu13:v2)</span><br><span class="line">查看镜像版本</span><br><span class="line">docker search 镜像名</span><br><span class="line"></span><br><span class="line">批量停止所有容器</span><br><span class="line">docker stop $(docker ps -qa)</span><br><span class="line">删除容器</span><br><span class="line">docker rm -f id</span><br><span class="line">查看所有容器id</span><br><span class="line">docker pa -aq</span><br><span class="line"></span><br><span class="line">后台容器在线运行</span><br><span class="line">docker attach id</span><br><span class="line">打印后台运行容器日志 （动态打印跟踪 -f）</span><br><span class="line">docker logs id</span><br><span class="line"></span><br><span class="line">查看容器进程</span><br><span class="line">docker top id</span><br><span class="line"></span><br><span class="line">快速清理所有退出的容器</span><br><span class="line">docker system prune -f</span><br><span class="line">快速清理所有没有使用的镜像</span><br><span class="line">docker image prune -f</span><br><span class="line"></span><br><span class="line">容器自动重启</span><br><span class="line">docker run --restart=always</span><br><span class="line">已经启动了则可以使用</span><br><span class="line">docker update --restart=always &lt;CONTAINER ID&gt;</span><br><span class="line"></span><br><span class="line">关闭自动重启</span><br><span class="line">docker update --restart=no &lt;CONTAINER ID&gt;</span><br></pre></td></tr></table></figure>

<blockquote>
<p>docker run -d -p 80:80 –name 容器名 镜像名</p>
<p>背后发生了什么：</p>
<p>1、在本地查找是否有该镜像</p>
<p>2、没有则去远程仓库找该镜像，默认docker hub仓库</p>
<p>3、下载最新镜像</p>
<p>4、基于该镜像创建一个容器，并且准备运行</p>
<p>5、docker engine分配给这个容器一个虚拟的ip地址</p>
<p>6、在宿主机上打开80端口并把端口转发到宿主机上</p>
<p>7、启动容器，运行指令（这里是一个shell脚本去启动命令）</p>
</blockquote>
<h2 id="1）镜像导入导出"><a href="#1）镜像导入导出" class="headerlink" title="1）镜像导入导出"></a>1）镜像导入导出</h2><p>·导出成镜像文件</p>
<p>docker image save 镜像名 -o 导出镜像文件名</p>
<p>docker image save nginx:v1 -o nginx.image</p>
<p>·导入镜像文件</p>
<p>docker image load -i 当前文件夹下的镜像文件名</p>
<p>docker image load -i .&#x2F;nginx.image</p>
<h1 id="三、docker-file镜像构建"><a href="#三、docker-file镜像构建" class="headerlink" title="三、docker file镜像构建"></a>三、docker file镜像构建</h1><p>一、镜像获取</p>
<blockquote>
<p>1、registry拉取（公有、私有）</p>
<p>2、dockfile在线构建</p>
<p>3、file文件离线导入</p>
</blockquote>
<p>二、构建dockerfile的基本结构</p>
<blockquote>
<p>From 以什么为基础（基础镜像）</p>
<p>Run 运行一些linux命令安装软件（运行环境）</p>
<p>Add 添加一些文件</p>
<p>Cmd 执行一些文件命令</p>
<p>env 引用变量</p>
<p>copy 复制文件到进行中</p>
<p>entrypoint 与cmd作用相同，但该指令必定执行，多个cmd执行做后一个</p>
</blockquote>
<table>
<thead>
<tr>
<th>关键字</th>
<th>作用</th>
<th>备注</th>
</tr>
</thead>
<tbody><tr>
<td>FROM</td>
<td>指定父镜像</td>
<td>指定dockerfile基于那个image构建</td>
</tr>
<tr>
<td>MAINTAINER</td>
<td>作者信息</td>
<td>用来标明这个dockerfile谁写的</td>
</tr>
<tr>
<td>LABEL</td>
<td>标签</td>
<td>用来标明dockerfile的标签 可以使用Label代替Maintainer 最终都是在docker image基本信息中可以查看</td>
</tr>
<tr>
<td>RUN</td>
<td>执行命令</td>
<td>执行一段命令 默认是&#x2F;bin&#x2F;sh 格式: RUN command 或者 RUN [“command” , “param1”,”param2”]</td>
</tr>
<tr>
<td>CMD</td>
<td>容器启动命令</td>
<td>提供启动容器时候的默认命令 和ENTRYPOINT配合使用.格式 CMD command param1 param2 或者 CMD [“command” , “param1”,”param2”]</td>
</tr>
<tr>
<td>ENTRYPOINT</td>
<td>入口</td>
<td>一般在制作一些执行就关闭的容器中会使用</td>
</tr>
<tr>
<td>COPY</td>
<td>复制文件</td>
<td>build的时候复制文件到image中</td>
</tr>
<tr>
<td>ADD</td>
<td>添加文件</td>
<td>build的时候添加文件到image中 不仅仅局限于当前build上下文 可以来源于远程服务</td>
</tr>
<tr>
<td>ENV</td>
<td>环境变量</td>
<td>指定build时候的环境变量 可以在启动的容器的时候 通过-e覆盖 格式ENV name&#x3D;value</td>
</tr>
<tr>
<td>ARG</td>
<td>构建参数</td>
<td>构建参数 只在构建的时候使用的参数 如果有ENV 那么ENV的相同名字的值始终覆盖arg的参数</td>
</tr>
<tr>
<td>VOLUME</td>
<td>定义外部可以挂载的数据卷</td>
<td>指定build的image那些目录可以启动的时候挂载到文件系统中 启动容器的时候使用 -v 绑定 格式 VOLUME [“目录”]</td>
</tr>
<tr>
<td>EXPOSE</td>
<td>暴露端口</td>
<td>定义容器运行的时候监听的端口 启动容器的使用-p来绑定暴露端口 格式: EXPOSE 8080 或者 EXPOSE 8080&#x2F;udp</td>
</tr>
<tr>
<td>WORKDIR</td>
<td>工作目录</td>
<td>指定容器内部的工作目录 如果没有创建则自动创建 如果指定&#x2F; 使用的是绝对地址 如果不是&#x2F;开头那么是在上一条workdir的路径的相对路径</td>
</tr>
<tr>
<td>USER</td>
<td>指定执行用户</td>
<td>指定build或者启动的时候 用户 在RUN CMD ENTRYPONT执行的时候的用户</td>
</tr>
<tr>
<td>HEALTHCHECK</td>
<td>健康检查</td>
<td>指定监测当前容器的健康监测的命令 基本上没用 因为很多时候 应用本身有健康监测机制</td>
</tr>
<tr>
<td>ONBUILD</td>
<td>触发器</td>
<td>当存在ONBUILD关键字的镜像作为基础镜像的时候 当执行FROM完成之后 会执行 ONBUILD的命令 但是不影响当前镜像 用处也不怎么大</td>
</tr>
<tr>
<td>STOPSIGNAL</td>
<td>发送信号量到宿主机</td>
<td>该STOPSIGNAL指令设置将发送到容器的系统调用信号以退出。</td>
</tr>
<tr>
<td>SHELL</td>
<td>指定执行脚本的shell</td>
<td>指定RUN CMD ENTRYPOINT 执行命令的时候 使用的shell</td>
</tr>
</tbody></table>
<p>三、构建命令：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">Hello名称名 .当前文件位置</span><br><span class="line">Docker image build -t hello .</span><br></pre></td></tr></table></figure>

<p>四、构建示例</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br></pre></td><td class="code"><pre><span class="line">示例1:构建一个ubuntu镜像，启动时打印出hello dockerName</span><br><span class="line">1、创建Dockerfile目录</span><br><span class="line">2、编辑文件 vim docker-ubuntu</span><br><span class="line">FROM ubuntu:21.04</span><br><span class="line">RUN apt-get update  &amp;&amp; \</span><br><span class="line">    apt-get install -y wget &amp;&amp; \</span><br><span class="line">    wget https://github.com/ipinfo/cli/releases/download/ipinfo-2.0.1/ipinfo_2.0.1_linux_amd64.tar.gz &amp;&amp; \</span><br><span class="line">    tar zxf ipinfo_2.0.1_linux_amd64.tar.gz &amp;&amp; \</span><br><span class="line">    mv ipinfo_2.0.1_linux_amd64 /usr/bin/ipinfo &amp;&amp; \</span><br><span class="line">    rm -rf ipinfo_2.0.1_linux_amd64.tar.gz</span><br><span class="line"></span><br><span class="line">env NAME=dockerName</span><br><span class="line">cmd echo &quot;hello $NAME&quot;</span><br><span class="line"></span><br><span class="line">3、构建镜像文件</span><br><span class="line">docker build -f 文件名 -t 镜像名:版本 .当前目录路径</span><br><span class="line">docker build -f docker-ubuntu -t ubuntu:v1 .</span><br><span class="line"></span><br><span class="line">打包容器成镜像</span><br><span class="line">docker commit 容器ID 镜像名称</span><br><span class="line">4、执行容器</span><br><span class="line">Docker	run -it ubuntu:v1 	启动一个交互式容器</span><br><span class="line">Docker	run —rm -it ubuntu:v1 执行后容器停止删除容器</span><br><span class="line">Docker	run —rm -it ubuntu:v1 echo “打印语句”</span><br><span class="line"></span><br><span class="line">5、上传镜像</span><br><span class="line">登录远程仓库（用户名密码）</span><br><span class="line">docker login/logout</span><br><span class="line">容器命名（跟镜像仓库名保持一致）</span><br><span class="line">docker image tag 原镜像名 新镜像名</span><br><span class="line">docker image tag ubuntu:v1 1305366530/ubuntu:v1</span><br><span class="line">docker push 路径/镜像名</span><br><span class="line">docker push 1305366530/ubuntu:v1</span><br><span class="line"></span><br><span class="line">修改文件</span><br><span class="line">Echo “修改内容” 文件名</span><br><span class="line">查看文件</span><br><span class="line">more 文件名</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">多阶段构建</span><br><span class="line">as 别名</span><br><span class="line">—from 引入</span><br><span class="line">￼</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">示例2:构建一个nginx镜像</span><br><span class="line"></span><br><span class="line">构建dockerfile</span><br><span class="line">1、在一个空目录下，新建一个名为 Dockerfile 文件，并在文件内添加以下内容：</span><br><span class="line">FROM nginx</span><br><span class="line">RUN echo &#x27;这是一个本地构建的nginx镜像&#x27; &gt; /usr/share/nginx/html/index.html</span><br><span class="line">2、在 Dockerfile 文件的存放目录下，执行构建动作。. 代表本次执行的上下文路径</span><br><span class="line">docker build -t nginx:v3 .</span><br></pre></td></tr></table></figure>



<h1 id="四、docker存储-volume数据卷"><a href="#四、docker存储-volume数据卷" class="headerlink" title="四、docker存储 volume数据卷"></a>四、docker存储 volume数据卷</h1><p>Windows中使用弊端：volume路径是保存在虚拟机里面的，在windos中是无法查看到这个虚拟路径的</p>
<p>-v参数：指定数据卷存储位置</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">dockera安装mysql</span><br><span class="line">1、docker pull mysql:5.7</span><br><span class="line">2、docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=123456 -d -v mysql-data:/var/lib/mysql mysql:5.7</span><br><span class="line">3、查看volume</span><br><span class="line">docker volume ls</span><br><span class="line">4、查看volume路径</span><br><span class="line">docker volume inspect mysql-data</span><br><span class="line">5、查看volume文件</span><br><span class="line">Docker volume ls (查看所有持久化文件)</span><br><span class="line">docker volume inspect volumename（查看持久化路径）</span><br><span class="line">docker volume prune (删除没有使用的volume)</span><br><span class="line">More 路径/文件名（查看文件内容）</span><br><span class="line">6、强制删除容器，查看volume是否存在</span><br><span class="line">docker rm -f id</span><br><span class="line">docker volume ls</span><br></pre></td></tr></table></figure>

<h1 id="5、docker网络"><a href="#5、docker网络" class="headerlink" title="5、docker网络"></a>5、docker网络</h1><h1 id="6、docker-compose"><a href="#6、docker-compose" class="headerlink" title="6、docker compose"></a>6、docker compose</h1><ul>
<li><p>使用 Docker Compose 可以轻松、高效的管理容器，它是一个用于定义和运行多容器 Docker 的应用程序工具</p>
<p><img src="https://gitee.com/lindaifeng/img/raw/master/img/20220123231219.png" alt="1"></p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">示例：docker-compose.yml</span><br><span class="line">version: &quot;3.8&quot;</span><br><span class="line">service:</span><br><span class="line">    flask-demo:</span><br><span class="line">        image: flask-demo:latest</span><br><span class="line">        environment:</span><br><span class="line">            - REDIS_HOST=redis-server</span><br><span class="line">        network:</span><br><span class="line">            - demo-network</span><br><span class="line">        ports:</span><br><span class="line">            - 8080:5000</span><br><span class="line">    redis-server:</span><br><span class="line">        image: redis:latest</span><br><span class="line">        networks:</span><br><span class="line">            - demo-network</span><br><span class="line">    networks:</span><br><span class="line">        demo-network:</span><br></pre></td></tr></table></figure>



<figure class="highlight ruby"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">安装 <span class="title class_">Docker</span> <span class="title class_">Compose</span> 可以通过下面命令自动下载适应版本的 <span class="title class_">Compose</span>，并为安装脚本添加执行权限</span><br><span class="line">sudo curl -L <span class="symbol">https:</span>/<span class="regexp">/github.com/docker</span><span class="regexp">/compose/releases</span><span class="regexp">/download/</span><span class="number">1.21</span>.<span class="number">2</span>/docker-compose-<span class="variable">$(</span>uname -s)-<span class="variable">$(</span>uname -m) -o /usr/local/bin/docker-compose</span><br><span class="line">sudo chmod +x /usr/local/bin/docker-compose</span><br><span class="line">查看安装是否成功</span><br><span class="line">docker-compose -v</span><br><span class="line"></span><br></pre></td></tr></table></figure></li>
</ul>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line">快速入门</span><br><span class="line">1、打包项目，获得 jar 包 docker-demo-0.0.1-SNAPSHOT.jar</span><br><span class="line">mvn clean package</span><br><span class="line">2、在 jar 包所在路径创建 Dockerfile 文件，添加以下内容</span><br><span class="line">FROM java:8</span><br><span class="line">VOLUME /tmp</span><br><span class="line">ADD docker-demo-0.0.1-SNAPSHOT.jar app.jar</span><br><span class="line">RUN bash -c &#x27;touch /app.jar&#x27;</span><br><span class="line">EXPOSE 9000</span><br><span class="line">ENTRYPOINT [&quot;java&quot;,&quot;-Djava.security.egd=file:/dev/./urandom&quot;,&quot;-jar&quot;,&quot;app.jar&quot;]</span><br><span class="line">3、在 jar 包所在路径创建文件 docker-compose.yml，添加以下内容</span><br><span class="line">version: &#x27;2&#x27; # 表示该 Docker-Compose 文件使用的是 Version 2 file</span><br><span class="line">services:</span><br><span class="line">  docker-demo:  # 指定服务名称</span><br><span class="line">    build: .  # 指定 Dockerfile 所在路径</span><br><span class="line">    ports:    # 指定端口映射</span><br><span class="line">      - &quot;9000:8761&quot;</span><br><span class="line">4、在 docker-compose.yml 所在路径下执行该命令 Compose 就会自动构建镜像并使用镜像启动容器</span><br><span class="line">docker-compose up</span><br><span class="line">docker-compose up -d  // 后台启动并运行容器</span><br><span class="line">5、访问 http://localhost:9000/hello 即可访问微服务接口</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br></pre></td><td class="code"><pre><span class="line">Docker Compose 常用命令与配置</span><br><span class="line">常见命令</span><br><span class="line">1、ps：列出所有运行容器</span><br><span class="line">docker-compose ps</span><br><span class="line">2、logs：查看服务日志输出</span><br><span class="line">docker-compose logs</span><br><span class="line">3、port：打印绑定的公共端口，下面命令可以输出 eureka 服务 8761 端口所绑定的公共端口</span><br><span class="line">docker-compose port eureka 8761</span><br><span class="line">4、build：构建或者重新构建服务</span><br><span class="line">docker-compose build</span><br><span class="line">5、start：启动指定服务已存在的容器</span><br><span class="line">docker-compose start eureka</span><br><span class="line">6、stop：停止已运行的服务的容器</span><br><span class="line">docker-compose stop eureka</span><br><span class="line">7、rm：删除指定服务的容器</span><br><span class="line">docker-compose rm eureka</span><br><span class="line">8、up：构建、启动容器</span><br><span class="line">docker-compose up</span><br><span class="line">9、kill：通过发送 SIGKILL 信号来停止指定服务的容器</span><br><span class="line">docker-compose kill eureka</span><br><span class="line">10、pull：下载服务镜像</span><br><span class="line">11、scale：设置指定服务运气容器的个数，以 service=num 形式指定</span><br><span class="line">docker-compose scale user=3 movie=3</span><br><span class="line">12、run：在一个服务上执行一个命令</span><br><span class="line">docker-compose run web bash</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<h2 id="Docker-Compose示例："><a href="#Docker-Compose示例：" class="headerlink" title="Docker Compose示例："></a>Docker Compose示例：</h2><h3 id="一、安装Docker-Compose"><a href="#一、安装Docker-Compose" class="headerlink" title="一、安装Docker Compose"></a>一、安装Docker Compose</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">Compose目前已经完全支持Linux、Mac OS和Windows，在我们安装Compose之前，需要先安装Docker。下面我 们以编译好的二进制包方式安装在Linux系统中。</span> </span><br><span class="line">curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">设置文件可执行权限</span> </span><br><span class="line">chmod +x /usr/local/bin/docker-compose</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看版本信息</span> </span><br><span class="line">docker-compose -version</span><br></pre></td></tr></table></figure>

<h3 id="二、卸载Docker-Compose"><a href="#二、卸载Docker-Compose" class="headerlink" title="二、卸载Docker Compose"></a>二、卸载Docker Compose</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">二进制包方式安装的，删除二进制文件即可</span></span><br><span class="line">rm /usr/local/bin/docker-compose</span><br></pre></td></tr></table></figure>



<h3 id="三、-使用docker-compose编排nginx-springboot项目"><a href="#三、-使用docker-compose编排nginx-springboot项目" class="headerlink" title="三、 使用docker compose编排nginx+springboot项目"></a>三、 使用docker compose编排nginx+springboot项目</h3><ol>
<li>创建docker-compose目录</li>
</ol>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">mkdir ~/docker-compose</span><br><span class="line">cd ~/docker-compose</span><br></pre></td></tr></table></figure>

<ol start="2">
<li>编写 docker-compose.yml 文件</li>
</ol>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">version: &#x27;3&#x27;</span><br><span class="line">services:</span><br><span class="line">  nginx:</span><br><span class="line">   image: nginx</span><br><span class="line">   ports:</span><br><span class="line">    - 80:80</span><br><span class="line">   links:</span><br><span class="line">    - app</span><br><span class="line">   volumes:</span><br><span class="line">    - ./nginx/conf.d:/etc/nginx/conf.d</span><br><span class="line">  app:</span><br><span class="line">    image: app</span><br><span class="line">    expose:</span><br><span class="line">      - &quot;8080&quot;</span><br></pre></td></tr></table></figure>

<ol start="3">
<li>创建.&#x2F;nginx&#x2F;conf.d目录</li>
</ol>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mkdir -p ./nginx/conf.d</span><br></pre></td></tr></table></figure>



<ol start="4">
<li>在.&#x2F;nginx&#x2F;conf.d目录下 编写itheima.conf文件</li>
</ol>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">server &#123;</span><br><span class="line">    listen 80;</span><br><span class="line">    access_log off;</span><br><span class="line"></span><br><span class="line">    location / &#123;</span><br><span class="line">        proxy_pass http://app:8080;</span><br><span class="line">    &#125;</span><br><span class="line">   </span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<ol start="5">
<li>在~&#x2F;docker-compose 目录下 使用docker-compose 启动容器</li>
</ol>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker-compose up</span><br></pre></td></tr></table></figure>

<ol start="6">
<li>测试访问</li>
</ol>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">http://192.168.149.135/hello</span><br></pre></td></tr></table></figure>



<h1 id="7、docker-swarm容器编排"><a href="#7、docker-swarm容器编排" class="headerlink" title="7、docker swarm容器编排"></a>7、docker swarm容器编排</h1><p>docker compose不建议在生产环境使用，因为是它是运行在单机环境下</p>
<p>多机的环境下则需要用到docker swarm。</p>
<blockquote>
<p>Docker Swarm 是 Docker 的集群管理工具。它将 Docker 主机池转变为单个虚拟 Docker 主机。 Docker Swarm 提供了标准的 Docker API，所有任何已经与 Docker 守护程序通信的工具都可以使用 Swarm 轻松地扩展到多个主机。</p>
</blockquote>
<p>k8s在容器编排领域处于绝对领先的地位</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">查看是否激活swarm模式（默认没有）</span><br><span class="line">docker info</span><br><span class="line">Swarm: inactive表示没有激活</span><br><span class="line">激活swarm，两个方法</span><br><span class="line">1、初始化一个swarm集群</span><br><span class="line">docker swarm init</span><br><span class="line">docker node ls（查看集群节点）</span><br><span class="line">2、加入一个已存在的swarm集群 </span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">docker swarm init(初始化集群)</span><br><span class="line">docker node ls（查看集群节点）</span><br><span class="line">docker swarm leave --force（强制离开集群）</span><br></pre></td></tr></table></figure>



<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">创建一个nginx服务</span><br><span class="line">docker service create nginx:latest</span><br><span class="line">查看nginx服务</span><br><span class="line">docker service ls</span><br><span class="line">docker service ps 服务id</span><br><span class="line">复制三个service</span><br><span class="line">docker service update 服务id --replicas 3</span><br><span class="line">当我们删除一个容器后，swarm会帮我们创建一个容器运行起来（即创建容器又帮我们维护容器）</span><br><span class="line">docker rm -f 容器id</span><br><span class="line">要想删除则需要对service进行操作</span><br><span class="line">docker service rm 服务ID</span><br></pre></td></tr></table></figure>



<h1 id="8、docker-多架构支持"><a href="#8、docker-多架构支持" class="headerlink" title="8、docker 多架构支持"></a>8、docker 多架构支持</h1>
      
    </div>
    <footer class="article-footer">
      
        <div id="donation_div"></div>


<script src="/qingfeng-blog/js/vdonate.js"></script>

<script>
var a = new Donate({
  title: '如果觉得我的文章对您有用，请随意打赏。您的支持将鼓励我继续创作!', // 可选参数，打赏标题
  btnText: 'Donate', // 可选参数，打赏按钮文字
  el: document.getElementById('donation_div'),
  wechatImage: 'http://img.lindaifeng.vip/typora-picgo-tuchaung/20230428150832.png',
  alipayImage: 'http://img.lindaifeng.vip/typora-picgo-tuchaung/20230428150823.png'
});
</script>
      
      
      <div>
        <ul class="post-copyright">
          <li class="post-copyright-author">
          <strong>Post author:  </strong>清峰</a>
          </li>
          <li class="post-copyright-link">
          <strong>Post link:  </strong>
          <a href="/qingfeng-blog/2022/01/27/Docker/Docker介绍/" target="_blank" title="Docker介绍">http://example.com/2022/01/27/Docker/Docker介绍/</a>
          </li>
          <li class="post-copyright-license">
            <strong>Copyright Notice:   </strong>
            All articles in this blog are licensed under <a rel="license" href="https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank" title="Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)">CC BY-NC-ND 4.0</a>
            unless stating additionally.
          </li>
         
        </ul>
<div>

      
      
        
	<div id="comment">
		<!-- 来必力City版安装代码 -->
		<div id="lv-container" data-id="city" data-uid="MTAyMC8yOTQ4MS82MDQ5">
		<script type="text/javascript">
		   (function(d, s) {
		       var j, e = d.getElementsByTagName(s)[0];

		       if (typeof LivereTower === 'function') { return; }

		       j = d.createElement(s);
		       j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
		       j.async = true;

		       e.parentNode.insertBefore(j, e);
		   })(document, 'script');
		</script>
		<noscript>为正常使用来必力评论功能请激活JavaScript</noscript>
		</div>
		<!-- City版安装代码已完成 -->
	</div>



      
      
        
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/qingfeng-blog/tags/docker/" rel="tag">docker</a></li></ul>

      

    </footer>
  </div>
</div>
  
    
<nav id="article-nav">
  
    <a href="/qingfeng-blog/2022/03/09/Mysql/Mysql5.7%E5%8D%87%E7%BA%A7%E5%B0%8F%E7%89%88%E6%9C%AC/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Newer</strong>
      <div class="article-nav-title">
        
          Mysql5.7升级小版本
        
      </div>
    </a>
  
  
    <a href="/qingfeng-blog/2021/11/30/Linux/Java%20%E5%BC%80%E5%8F%91%E5%B8%B8%E7%94%A8%E7%9A%84%20Linux%20%E5%91%BD%E4%BB%A4/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Older</strong>
      <div class="article-nav-title">Java 开发常用的 Linux 命令</div>
    </a>
  
</nav>

  
</article>

<!-- Table of Contents -->

  <aside id="toc-sidebar">
    <div id="toc" class="toc-article">
    <strong class="toc-title">Contents</strong>
    
        <ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%B8%80%E3%80%81docker%E5%AE%89%E8%A3%85"><span class="nav-number">1.</span> <span class="nav-text">一、docker安装</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%BA%8C%E3%80%81docker%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4"><span class="nav-number">2.</span> <span class="nav-text">二、docker常用命令</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1%EF%BC%89%E9%95%9C%E5%83%8F%E5%AF%BC%E5%85%A5%E5%AF%BC%E5%87%BA"><span class="nav-number">2.1.</span> <span class="nav-text">1）镜像导入导出</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%B8%89%E3%80%81docker-file%E9%95%9C%E5%83%8F%E6%9E%84%E5%BB%BA"><span class="nav-number">3.</span> <span class="nav-text">三、docker file镜像构建</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%9B%9B%E3%80%81docker%E5%AD%98%E5%82%A8-volume%E6%95%B0%E6%8D%AE%E5%8D%B7"><span class="nav-number">4.</span> <span class="nav-text">四、docker存储 volume数据卷</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#5%E3%80%81docker%E7%BD%91%E7%BB%9C"><span class="nav-number">5.</span> <span class="nav-text">5、docker网络</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#6%E3%80%81docker-compose"><span class="nav-number">6.</span> <span class="nav-text">6、docker compose</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#Docker-Compose%E7%A4%BA%E4%BE%8B%EF%BC%9A"><span class="nav-number">6.1.</span> <span class="nav-text">Docker Compose示例：</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E4%B8%80%E3%80%81%E5%AE%89%E8%A3%85Docker-Compose"><span class="nav-number">6.1.1.</span> <span class="nav-text">一、安装Docker Compose</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E4%BA%8C%E3%80%81%E5%8D%B8%E8%BD%BDDocker-Compose"><span class="nav-number">6.1.2.</span> <span class="nav-text">二、卸载Docker Compose</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E4%B8%89%E3%80%81-%E4%BD%BF%E7%94%A8docker-compose%E7%BC%96%E6%8E%92nginx-springboot%E9%A1%B9%E7%9B%AE"><span class="nav-number">6.1.3.</span> <span class="nav-text">三、 使用docker compose编排nginx+springboot项目</span></a></li></ol></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#7%E3%80%81docker-swarm%E5%AE%B9%E5%99%A8%E7%BC%96%E6%8E%92"><span class="nav-number">7.</span> <span class="nav-text">7、docker swarm容器编排</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#8%E3%80%81docker-%E5%A4%9A%E6%9E%B6%E6%9E%84%E6%94%AF%E6%8C%81"><span class="nav-number">8.</span> <span class="nav-text">8、docker 多架构支持</span></a></li></ol>
    
    </div>
  </aside>


</section>
        
      </div>
      
      <footer id="footer">
  

  <div class="container">
      	<div class="row">
	      <!-- <p> Powered by <a href="http://hexo.io/" target="_blank">Hexo</a> and <a href="https://github.com/iTimeTraveler/hexo-theme-hiker" target="_blank">Hexo-theme-hiker</a> </p> -->
	      <p>May there be no bug in the world！</p>
        <p id="copyRightEn">Copyright &copy; 2022 - 2023 All Rights Reserved.</p>
	      
	      
    		<p class="busuanzi_uv">
				UV : <span id="busuanzi_value_site_uv"></span> |  
				PV : <span id="busuanzi_value_site_pv"></span>
		    </p>
  		   
		</div>

		
  </div>
</footer>


<!-- min height -->

<script>
    var wrapdiv = document.getElementById("wrap");
    var contentdiv = document.getElementById("content");
    var allheader = document.getElementById("allheader");

    wrapdiv.style.minHeight = document.body.offsetHeight + "px";
    if (allheader != null) {
      contentdiv.style.minHeight = document.body.offsetHeight - allheader.offsetHeight - document.getElementById("footer").offsetHeight + "px";
    } else {
      contentdiv.style.minHeight = document.body.offsetHeight - document.getElementById("footer").offsetHeight + "px";
    }
</script>
    </div>
    <!-- <nav id="mobile-nav">
  
    <a href="/qingfeng-blog/" class="mobile-nav-link">首页</a>
  
    <a href="/qingfeng-blog/categories" class="mobile-nav-link">分类</a>
  
    <a href="/qingfeng-blog/tags" class="mobile-nav-link">标签</a>
  
</nav> -->
    

<!-- mathjax config similar to math.stackexchange -->

<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    tex2jax: {
      inlineMath: [ ['$','$'], ["\\(","\\)"] ],
      processEscapes: true
    }
  });
</script>

<script type="text/x-mathjax-config">
    MathJax.Hub.Config({
      tex2jax: {
        skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
      }
    });
</script>

<script type="text/x-mathjax-config">
    MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for(i=0; i < all.length; i += 1) {
            all[i].SourceElement().parentNode.className += ' has-jax';
        }
    });
</script>

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>


  
<link rel="stylesheet" href="/qingfeng-blog/fancybox/jquery.fancybox.css">

  
<script src="/qingfeng-blog/fancybox/jquery.fancybox.pack.js"></script>




<script src="/qingfeng-blog/js/scripts.js"></script>



  
<script src="/qingfeng-blog/js/home.js"></script>




  
<script src="/qingfeng-blog/js/dialog.js"></script>









	<div style="display: none;">
    <script src="https://s95.cnzz.com/z_stat.php?id=1260716016&web_id=1260716016" language="JavaScript"></script>
  </div>



	<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js">
	</script>






  </div>

  <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h2 class="modal-title" id="myModalLabel">设置</h2>
      </div>
      <hr style="margin-top:0px; margin-bottom:0px; width:80%; border-top: 3px solid #000;">
      <hr style="margin-top:2px; margin-bottom:0px; width:80%; border-top: 1px solid #000;">


      <div class="modal-body">
          <div style="margin:6px;">
            <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne" onclick="javascript:setFontSize();" aria-expanded="true" aria-controls="collapseOne">
              正文字号大小
            </a>
          </div>
          <div id="collapseOne" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingOne">
          <div class="panel-body">
            您已调整页面字体大小
          </div>
        </div>
      


          <div style="margin:6px;">
            <a data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" onclick="javascript:setBackground();" aria-expanded="true" aria-controls="collapseTwo">
              夜间护眼模式
            </a>
        </div>
          <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
          <div class="panel-body">
            夜间模式已经开启，再次单击按钮即可关闭 
          </div>
        </div>

        <div>
            <a data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="true" aria-controls="collapseThree">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;关 于&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
        </div>
         <div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">
          <div class="panel-body">
            清峰小栈
          </div>
          <div class="panel-body">
            Copyright © 2023 清峰 All Rights Reserved.
          </div>
        </div>
      </div>


      <hr style="margin-top:0px; margin-bottom:0px; width:80%; border-top: 1px solid #000;">
      <hr style="margin-top:2px; margin-bottom:0px; width:80%; border-top: 3px solid #000;">
      <div class="modal-footer">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
      </div>
    </div>
  </div>
</div>
  
  <a id="rocket" href="#top" class=""></a>
  <script type="text/javascript" src="/qingfeng-blog/js/totop.js?v=1.0.0" async=""></script>
  
    <a id="menu-switch"><i class="fa fa-bars fa-lg"></i></a>
  
</body>
</html>